package com.example.emos.api.service.impl;

import com.example.emos.api.common.util.PageUtils;
import com.example.emos.api.db.dao.TbTattooDao;
import com.example.emos.api.db.pojo.TbTattoo;
import com.example.emos.api.service.TattooService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
@Service
public class TattooServiceImpl implements TattooService {
    @Autowired
    private TbTattooDao tbTattooDao;
    @Override
    public ArrayList<HashMap> searchAllTattoos() {
        ArrayList<HashMap> list = tbTattooDao.searchAllTattoo();
        return list;
    }

    @Override
    public PageUtils searchTattooByPage(HashMap param) {
        ArrayList<HashMap> list= tbTattooDao.searchTattooByPage(param);
        long count=tbTattooDao.searchTattooCount(param);
        int start=(Integer) param.get("start");
        int length=(Integer) param.get("length");
        PageUtils pageUtils=new PageUtils(list,count,start,length);
        return pageUtils;
    }

    @Override
    public int insertTattoos(ArrayList<TbTattoo> tattoos) {
       int row= tbTattooDao.insertTattoos(tattoos);
        return row;
    }

    @Override
    public int updateTattooByGlobalId(HashMap param) {
        return tbTattooDao.updateTattooByGlobalId(param);
    }
}
